package com.ft.oa.web.sys;

import com.baomidou.mybatisplus.extension.plugins.pagination.Page;
import com.ft.oa.domain.dto.ApiResult;
import com.ft.oa.domain.sys.SysOperateLog;
import com.ft.oa.service.sys.SysOperateLogService;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.util.List;

/**
 * 操作记录接口
 */
@RestController
@RequestMapping("/sys/operate")
public class SysOperateLogController {

    @Resource
    private SysOperateLogService sysOperateLogService;

    /**
     * 分页查询操作记录
     * @param operateLog
     * @return
     */
    @PostMapping("/page")
    @PreAuthorize("@ss.havePermission()")
    public ApiResult page(@RequestBody SysOperateLog operateLog){

        Page<SysOperateLog> result = sysOperateLogService.page(operateLog);

        return ApiResult.successWithData(result);
    }

    /**
     * 操作模块列表
     * @return
     */
    @GetMapping("/module/list")
    public ApiResult moduleList(){

        List<String> result = sysOperateLogService.moduleList();

        return ApiResult.successWithData(result);
    }
}
